<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>05-父容器属性-align-items</title>
</head>
<body>
  <!-- 
    align-items: 设置单行子项目在侧轴方向上的对齐方式
      flex-start：沿侧轴起点对齐。(高度随内容撑开)
      center：沿侧轴居中对齐。(高度随内容撑开)
      flex-end：沿侧轴终点对齐。(高度随内容撑开)
      stretch：沿侧轴拉伸撑满整个容器。(不设置高度则拉伸，设置高度则固定)
      baseline：沿着基线对齐。(高度随内容撑开)
      normal：默认值。等同于stretch。

      前5个子项目只设置宽度，不设置高度
      最后一个子项目同时设置宽高
   -->
  <style>
    body {
      margin: 0;
      padding: 0;
      display: flex;
      flex-wrap: wrap;
      margin: 60px;
    }
    div {
      box-sizing: border-box;
      border-radius: 5px;
    }
    .box {
      width: 500px;
      height: 160px;
      background-color: #ffffff;
      border: 1px solid #ddd;
      box-shadow: 0px 1px 10px 1px #ddd;
      margin: 10px;

      display: flex;
    }
    .item {
      width: 100px;
      background-color: red;
      text-align: center;
      font-size: 26px;
      color: #fff;
    }

    .box1 {
      align-items: flex-start;
    }
    .box1 > .item {
      background-color: red;
    }

    .box2 {
      align-items: center;
    }
    .box2 > .item {
      background-color: blue;
    }

    .box3 {
      align-items: flex-end;
    }
    .box3 > .item {
      background-color: purple;
    }

    .box4 {
      align-items: stretch;
    }
    .box4 > .item {
      background-color: brown;
    }

    .box5 {
      align-items: baseline;
    }
    .box5 > .item {
      background-color: chocolate;
    }
    .box5 > .item:nth-child(1) {
      font-size: 36px;
    }
    .box5 > .item:nth-child(3) {
      font-size: 66px;
    }

    .box6 {
      align-items: normal;
    }
    .box6 > .item {
      background-color: goldenrod;
      height: 50px;
    }
  </style>
  
  <div class="box box1">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
  <div class="box box2">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
  <div class="box box3">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
  <div class="box box4">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
  <div class="box box5">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
  <div class="box box6">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>
</body>
</html>